<html>
<head>
<title>File Source for LevenbergMarquardt.php</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
    <td class="header_top">PHPExcel</td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td class="header_menu">
        
                                    
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          		  [ <a href="../classtrees_PHPExcel.html" class="menu">class tree: PHPExcel</a> ]
		  [ <a href="../elementindex_PHPExcel.html" class="menu">index: PHPExcel</a> ]
		  	    [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="200" class="menu">
	<div id="todolist">
			<p><a href="../todolist.html">Todo List</a></p>
	</div>
      <b>Packages:</b><br />
              <a href="../li_PHPExcel.html">PHPExcel</a><br />
              <a href="../li_JAMA.html">JAMA</a><br />
              <a href="../li_Math_Stats.html">Math_Stats</a><br />
              <a href="../li_PHPExcel_CachedObjectStorage.html">PHPExcel_CachedObjectStorage</a><br />
              <a href="../li_PHPExcel_Calculation.html">PHPExcel_Calculation</a><br />
              <a href="../li_PHPExcel_Cell.html">PHPExcel_Cell</a><br />
              <a href="../li_PHPExcel_Chart.html">PHPExcel_Chart</a><br />
              <a href="../li_PHPExcel_Chart_Renderer.html">PHPExcel_Chart_Renderer</a><br />
              <a href="../li_PHPExcel_Reader.html">PHPExcel_Reader</a><br />
              <a href="../li_PHPExcel_Reader_Excel5.html">PHPExcel_Reader_Excel5</a><br />
              <a href="../li_PHPExcel_Reader_Excel2007.html">PHPExcel_Reader_Excel2007</a><br />
              <a href="../li_PHPExcel_RichText.html">PHPExcel_RichText</a><br />
              <a href="../li_PHPExcel_Settings.html">PHPExcel_Settings</a><br />
              <a href="../li_PHPExcel_Shared.html">PHPExcel_Shared</a><br />
              <a href="../li_PHPExcel_Shared_Escher.html">PHPExcel_Shared_Escher</a><br />
              <a href="../li_PHPExcel_Shared_OLE.html">PHPExcel_Shared_OLE</a><br />
              <a href="../li_PHPExcel_Shared_Trend.html">PHPExcel_Shared_Trend</a><br />
              <a href="../li_PHPExcel_Shared_ZipArchive.html">PHPExcel_Shared_ZipArchive</a><br />
              <a href="../li_PHPExcel_Style.html">PHPExcel_Style</a><br />
              <a href="../li_PHPExcel_Worksheet.html">PHPExcel_Worksheet</a><br />
              <a href="../li_PHPExcel_Worksheet_Drawing.html">PHPExcel_Worksheet_Drawing</a><br />
              <a href="../li_PHPExcel_Writer.html">PHPExcel_Writer</a><br />
              <a href="../li_PHPExcel_Writer_Excel5.html">PHPExcel_Writer_Excel5</a><br />
              <a href="../li_PHPExcel_Writer_Excel2007.html">PHPExcel_Writer_Excel2007</a><br />
            <br /><br />
                  
      
                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1 align="center">Source for file LevenbergMarquardt.php</h1>
<p>Documentation is available at <a href="../PHPExcel/_PHPExcel---Shared---JAMA---examples---LevenbergMarquardt.php.html">LevenbergMarquardt.php</a></p>
<div class="src-code">
<ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><a name="a2"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-comm">//&nbsp;Levenberg-Marquardt&nbsp;in&nbsp;PHP</span></div></li>
<li><div class="src-line"><a name="a4"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-comm">//&nbsp;http://www.idiom.com/~zilla/Computer/Javanumeric/LM.java</span></div></li>
<li><div class="src-line"><a name="a6"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a7"></a><span class="src-key">class&nbsp;</span><a href="../PHPExcel/LevenbergMarquardt.html">LevenbergMarquardt</a>&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a8"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a9"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a10"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Calculate&nbsp;the&nbsp;current&nbsp;sum-squared-error</span></div></li>
<li><div class="src-line"><a name="a11"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a12"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Chi-squared&nbsp;is&nbsp;the&nbsp;distribution&nbsp;of&nbsp;squared&nbsp;Gaussian&nbsp;errors,</span></div></li>
<li><div class="src-line"><a name="a13"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;thus&nbsp;the&nbsp;name.</span></div></li>
<li><div class="src-line"><a name="a14"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">double[][]&nbsp;</span><span class="src-doc-var">$x&nbsp;</span></div></li>
<li><div class="src-line"><a name="a16"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">double[]&nbsp;</span><span class="src-doc-var">$a&nbsp;</span></div></li>
<li><div class="src-line"><a name="a17"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">double[]&nbsp;</span><span class="src-doc-var">$y,&nbsp;</span></div></li>
<li><div class="src-line"><a name="a18"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">double[]&nbsp;</span><span class="src-doc-var">$s,&nbsp;</span></div></li>
<li><div class="src-line"><a name="a19"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">object&nbsp;</span><span class="src-doc-var">$f&nbsp;</span></div></li>
<li><div class="src-line"><a name="a20"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a21"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../PHPExcel/LevenbergMarquardt.html#methodchiSquared">chiSquared</a><span class="src-sym">(</span><span class="src-var">$x</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a</span><span class="src-sym">,&nbsp;</span><span class="src-var">$y</span><span class="src-sym">,&nbsp;</span><span class="src-var">$s</span><span class="src-sym">,&nbsp;</span><span class="src-var">$f</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a22"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$npts&nbsp;</span>=&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a23"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$sum&nbsp;</span>=&nbsp;<span class="src-num">0.0</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a24"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a25"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&lt;&nbsp;<span class="src-var">$npts</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$i</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a26"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$d&nbsp;</span>=&nbsp;<span class="src-var">$y</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]&nbsp;</span>-&nbsp;<span class="src-var">$f</span><span class="src-sym">-&gt;</span><span class="src-id">val</span><span class="src-sym">(</span><span class="src-var">$x</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a27"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$d&nbsp;</span>=&nbsp;<span class="src-var">$d&nbsp;</span>/&nbsp;<span class="src-var">$s</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a28"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$sum&nbsp;</span>=&nbsp;<span class="src-var">$sum&nbsp;</span>+&nbsp;<span class="src-sym">(</span><span class="src-var">$d</span>*<span class="src-var">$d</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a29"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a30"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a31"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$sum</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a32"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;chiSquared()</span></div></li>
<li><div class="src-line"><a name="a33"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a34"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a35"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a36"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Minimize&nbsp;E&nbsp;=&nbsp;sum&nbsp;{(y[k]&nbsp;-&nbsp;f(x[k],a))&nbsp;/&nbsp;s[k]}^2</span></div></li>
<li><div class="src-line"><a name="a37"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;individual&nbsp;errors&nbsp;are&nbsp;optionally&nbsp;scaled&nbsp;by&nbsp;s[k].</span></div></li>
<li><div class="src-line"><a name="a38"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Note&nbsp;that&nbsp;LMfunc&nbsp;implements&nbsp;the&nbsp;value&nbsp;and&nbsp;gradient&nbsp;of&nbsp;f(x,a),</span></div></li>
<li><div class="src-line"><a name="a39"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;NOT&nbsp;the&nbsp;value&nbsp;and&nbsp;gradient&nbsp;of&nbsp;E&nbsp;with&nbsp;respect&nbsp;to&nbsp;a!</span></div></li>
<li><div class="src-line"><a name="a40"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a41"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">x&nbsp;</span><span class="src-doc">array&nbsp;of&nbsp;domain&nbsp;points,&nbsp;each&nbsp;may&nbsp;be&nbsp;multidimensional</span></div></li>
<li><div class="src-line"><a name="a42"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">y&nbsp;</span><span class="src-doc">corresponding&nbsp;array&nbsp;of&nbsp;values</span></div></li>
<li><div class="src-line"><a name="a43"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">a&nbsp;</span><span class="src-doc">the&nbsp;parameters/state&nbsp;of&nbsp;the&nbsp;model</span></div></li>
<li><div class="src-line"><a name="a44"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">vary&nbsp;</span><span class="src-doc">false&nbsp;to&nbsp;indicate&nbsp;the&nbsp;corresponding&nbsp;a[k]&nbsp;is&nbsp;to&nbsp;be&nbsp;held&nbsp;fixed</span></div></li>
<li><div class="src-line"><a name="a45"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">s2&nbsp;</span><span class="src-doc">sigma^2&nbsp;for&nbsp;point&nbsp;i</span></div></li>
<li><div class="src-line"><a name="a46"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">lambda&nbsp;</span><span class="src-doc">blend&nbsp;between&nbsp;steepest&nbsp;descent&nbsp;(lambda&nbsp;high)&nbsp;and</span></div></li>
<li><div class="src-line"><a name="a47"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jump&nbsp;to&nbsp;bottom&nbsp;of&nbsp;quadratic&nbsp;(lambda&nbsp;zero).</span></div></li>
<li><div class="src-line"><a name="a48"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Start&nbsp;with&nbsp;0.001.</span></div></li>
<li><div class="src-line"><a name="a49"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">termepsilon&nbsp;</span><span class="src-doc">termination&nbsp;accuracy&nbsp;(0.01)</span></div></li>
<li><div class="src-line"><a name="a50"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">maxiter&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;stop&nbsp;and&nbsp;return&nbsp;after&nbsp;this&nbsp;many&nbsp;iterations&nbsp;if&nbsp;not&nbsp;done</span></div></li>
<li><div class="src-line"><a name="a51"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@param&nbsp;</span><span class="src-doc-type">verbose&nbsp;</span><span class="src-doc">&nbsp;&nbsp;&nbsp;set&nbsp;to&nbsp;zero&nbsp;(no&nbsp;prints),&nbsp;1,&nbsp;2</span></div></li>
<li><div class="src-line"><a name="a52"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a53"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">the&nbsp;</span><span class="src-doc">new&nbsp;lambda&nbsp;for&nbsp;future&nbsp;iterations.</span></div></li>
<li><div class="src-line"><a name="a54"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;Can&nbsp;use&nbsp;this&nbsp;and&nbsp;maxiter&nbsp;to&nbsp;interleave&nbsp;the&nbsp;LM&nbsp;descent&nbsp;with&nbsp;some&nbsp;other</span></div></li>
<li><div class="src-line"><a name="a55"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;task,&nbsp;setting&nbsp;maxiter&nbsp;to&nbsp;something&nbsp;small.</span></div></li>
<li><div class="src-line"><a name="a56"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a57"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">function&nbsp;</span><a href="../PHPExcel/LevenbergMarquardt.html#methodsolve">solve</a><span class="src-sym">(</span><span class="src-var">$x</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a</span><span class="src-sym">,&nbsp;</span><span class="src-var">$y</span><span class="src-sym">,&nbsp;</span><span class="src-var">$s</span><span class="src-sym">,&nbsp;</span><span class="src-var">$vary</span><span class="src-sym">,&nbsp;</span><span class="src-var">$f</span><span class="src-sym">,&nbsp;</span><span class="src-var">$lambda</span><span class="src-sym">,&nbsp;</span><span class="src-var">$termepsilon</span><span class="src-sym">,&nbsp;</span><span class="src-var">$maxiter</span><span class="src-sym">,&nbsp;</span><span class="src-var">$verbose</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a58"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$npts&nbsp;</span>=&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$y</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a59"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nparm&nbsp;</span>=&nbsp;<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$a</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a60"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a61"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$verbose&nbsp;</span>&gt;&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a62"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print<span class="src-sym">(</span><span class="src-str">&quot;solve&nbsp;x[&quot;</span>.<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$x</span><span class="src-sym">)</span>.<span class="src-str">&quot;][&quot;</span>.<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$x</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span><span class="src-sym">)</span>.<span class="src-str">&quot;]&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a63"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print<span class="src-sym">(</span><span class="src-str">&quot;&nbsp;a[&quot;</span>.<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$a</span><span class="src-sym">)</span>.<span class="src-str">&quot;]&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a64"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id">println</span><span class="src-sym">(</span><span class="src-str">&quot;&nbsp;y[&quot;</span>.<a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-id">length</span><span class="src-sym">)</span>.<span class="src-str">&quot;]&quot;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a65"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a66"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a67"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$e0&nbsp;</span>=&nbsp;<span class="src-var">$this</span><span class="src-sym">-&gt;</span><a href="../PHPExcel/LevenbergMarquardt.html#methodchiSquared">chiSquared</a><span class="src-sym">(</span><span class="src-var">$x</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a</span><span class="src-sym">,&nbsp;</span><span class="src-var">$y</span><span class="src-sym">,&nbsp;</span><span class="src-var">$s</span><span class="src-sym">,&nbsp;</span><span class="src-var">$f</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a68"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a69"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//double&nbsp;lambda&nbsp;=&nbsp;0.001;</span></div></li>
<li><div class="src-line"><a name="a70"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$done&nbsp;</span>=&nbsp;<span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a71"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a72"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;g&nbsp;=&nbsp;gradient,&nbsp;H&nbsp;=&nbsp;hessian,&nbsp;d&nbsp;=&nbsp;step&nbsp;to&nbsp;minimum</span></div></li>
<li><div class="src-line"><a name="a73"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;H&nbsp;d&nbsp;=&nbsp;-g,&nbsp;solve&nbsp;for&nbsp;d</span></div></li>
<li><div class="src-line"><a name="a74"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$H&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a75"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$g&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a76"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a77"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//double[]&nbsp;d&nbsp;=&nbsp;new&nbsp;double[nparm];</span></div></li>
<li><div class="src-line"><a name="a78"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a79"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$oos2&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a80"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a81"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&lt;&nbsp;<span class="src-var">$npts</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$i</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a82"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$oos2</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-num">1.</span>/<span class="src-sym">(</span><span class="src-var">$s</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span>*<span class="src-var">$s</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a83"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a84"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$iter&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a85"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$term&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-comm">//&nbsp;termination&nbsp;count&nbsp;test</span></div></li>
<li><div class="src-line"><a name="a86"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a87"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do&nbsp;<span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a88"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++<span class="src-var">$iter</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a89"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a90"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;hessian&nbsp;approximation</span></div></li>
<li><div class="src-line"><a name="a91"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(&nbsp;</span><span class="src-var">$r&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$r&nbsp;</span>&lt;&nbsp;<span class="src-var">$nparm</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$r</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a92"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(&nbsp;</span><span class="src-var">$c&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$c&nbsp;</span>&lt;&nbsp;<span class="src-var">$nparm</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$c</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a93"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(&nbsp;</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&lt;&nbsp;<span class="src-var">$npts</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$i</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a94"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>==&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-var">$H</span><span class="src-sym">[</span><span class="src-var">$r</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-var">$c</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-num">0.</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a95"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$xi&nbsp;</span>=&nbsp;<span class="src-var">$x</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a96"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$H</span><span class="src-sym">[</span><span class="src-var">$r</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-var">$c</span><span class="src-sym">]&nbsp;</span>+=&nbsp;<span class="src-sym">(</span><span class="src-var">$oos2</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]&nbsp;</span>*&nbsp;<span class="src-var">$f</span><span class="src-sym">-&gt;</span><span class="src-id">grad</span><span class="src-sym">(</span><span class="src-var">$xi</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a</span><span class="src-sym">,&nbsp;</span><span class="src-var">$r</span><span class="src-sym">)&nbsp;</span>*&nbsp;<span class="src-var">$f</span><span class="src-sym">-&gt;</span><span class="src-id">grad</span><span class="src-sym">(</span><span class="src-var">$xi</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a</span><span class="src-sym">,&nbsp;</span><span class="src-var">$c</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a97"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;&nbsp;</span><span class="src-comm">//npts</span></div></li>
<li><div class="src-line"><a name="a98"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-comm">//c</span></div></li>
<li><div class="src-line"><a name="a99"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-comm">//r</span></div></li>
<li><div class="src-line"><a name="a100"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a101"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;boost&nbsp;diagonal&nbsp;towards&nbsp;gradient&nbsp;descent</span></div></li>
<li><div class="src-line"><a name="a102"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(&nbsp;</span><span class="src-var">$r&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$r&nbsp;</span>&lt;&nbsp;<span class="src-var">$nparm</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$r</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a103"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$H</span><span class="src-sym">[</span><span class="src-var">$r</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-var">$r</span><span class="src-sym">]&nbsp;</span>*=&nbsp;<span class="src-sym">(</span><span class="src-num">1.&nbsp;</span>+&nbsp;<span class="src-var">$lambda</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a104"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a105"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;gradient</span></div></li>
<li><div class="src-line"><a name="a106"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(&nbsp;</span><span class="src-var">$r&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$r&nbsp;</span>&lt;&nbsp;<span class="src-var">$nparm</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$r</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a107"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(&nbsp;</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&lt;&nbsp;<span class="src-var">$npts</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$i</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a108"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>==&nbsp;<span class="src-num">0</span><span class="src-sym">)&nbsp;</span><span class="src-var">$g</span><span class="src-sym">[</span><span class="src-var">$r</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-num">0.</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a109"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$xi&nbsp;</span>=&nbsp;<span class="src-var">$x</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a110"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$g</span><span class="src-sym">[</span><span class="src-var">$r</span><span class="src-sym">]&nbsp;</span>+=&nbsp;<span class="src-sym">(</span><span class="src-var">$oos2</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]&nbsp;</span>*&nbsp;<span class="src-sym">(</span><span class="src-var">$y</span><span class="src-sym">[</span><span class="src-var">$i</span><span class="src-sym">]</span>-<span class="src-var">$f</span><span class="src-sym">-&gt;</span><span class="src-id">val</span><span class="src-sym">(</span><span class="src-var">$xi</span><span class="src-sym">,</span><span class="src-var">$a</span><span class="src-sym">))&nbsp;</span>*&nbsp;<span class="src-var">$f</span><span class="src-sym">-&gt;</span><span class="src-id">grad</span><span class="src-sym">(</span><span class="src-var">$xi</span><span class="src-sym">,&nbsp;</span><span class="src-var">$a</span><span class="src-sym">,&nbsp;</span><span class="src-var">$r</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a111"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a112"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-comm">//npts</span></div></li>
<li><div class="src-line"><a name="a113"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a114"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;scale&nbsp;(for&nbsp;consistency&nbsp;with&nbsp;NR,&nbsp;not&nbsp;necessary)</span></div></li>
<li><div class="src-line"><a name="a115"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$false</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a116"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(&nbsp;</span><span class="src-var">$r&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$r&nbsp;</span>&lt;&nbsp;<span class="src-var">$nparm</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$r</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a117"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$g</span><span class="src-sym">[</span><span class="src-var">$r</span><span class="src-sym">]&nbsp;</span>=&nbsp;-<span class="src-num">0.5&nbsp;</span>*&nbsp;<span class="src-var">$g</span><span class="src-sym">[</span><span class="src-var">$r</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a118"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for</span><span class="src-sym">(&nbsp;</span><span class="src-var">$c&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$c&nbsp;</span>&lt;&nbsp;<span class="src-var">$nparm</span><span class="src-sym">;&nbsp;</span>++<span class="src-var">$c</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a119"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$H</span><span class="src-sym">[</span><span class="src-var">$r</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-var">$c</span><span class="src-sym">]&nbsp;</span>*=&nbsp;<span class="src-num">0.5</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a120"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a121"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a122"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a123"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a124"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;solve&nbsp;H&nbsp;d&nbsp;=&nbsp;-g,&nbsp;evaluate&nbsp;error&nbsp;at&nbsp;new&nbsp;location</span></div></li>
<li><div class="src-line"><a name="a125"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//double[]&nbsp;d&nbsp;=&nbsp;DoubleMatrix.solve(H,&nbsp;g);</span></div></li>
<li><div class="src-line"><a name="a126"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double[]&nbsp;d&nbsp;=&nbsp;(new&nbsp;Matrix(H)).lu().solve(new&nbsp;Matrix(g,&nbsp;nparm)).getRowPackedCopy();</span></div></li>
<li><div class="src-line"><a name="a127"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//double[]&nbsp;na&nbsp;=&nbsp;DoubleVector.add(a,&nbsp;d);</span></div></li>
<li><div class="src-line"><a name="a128"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double[]&nbsp;na&nbsp;=&nbsp;(new&nbsp;Matrix(a,&nbsp;nparm)).plus(new&nbsp;Matrix(d,&nbsp;nparm)).getRowPackedCopy();</span></div></li>
<li><div class="src-line"><a name="a129"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double&nbsp;e1&nbsp;=&nbsp;chiSquared(x,&nbsp;na,&nbsp;y,&nbsp;s,&nbsp;f);</span></div></li>
<li><div class="src-line"><a name="a130"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a131"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(verbose&nbsp;&gt;&nbsp;0)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a132"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&quot;\n\niteration&nbsp;&quot;+iter+&quot;&nbsp;lambda&nbsp;=&nbsp;&quot;+lambda);</span></div></li>
<li><div class="src-line"><a name="a133"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(&quot;a&nbsp;=&nbsp;&quot;);</span></div></li>
<li><div class="src-line"><a name="a134"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(new&nbsp;Matrix(a,&nbsp;nparm)).print(10,&nbsp;2);</span></div></li>
<li><div class="src-line"><a name="a135"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(verbose&nbsp;&gt;&nbsp;1)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a136"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(&quot;H&nbsp;=&nbsp;&quot;);</span></div></li>
<li><div class="src-line"><a name="a137"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(new&nbsp;Matrix(H)).print(10,&nbsp;2);</span></div></li>
<li><div class="src-line"><a name="a138"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(&quot;g&nbsp;=&nbsp;&quot;);</span></div></li>
<li><div class="src-line"><a name="a139"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(new&nbsp;Matrix(g,&nbsp;nparm)).print(10,&nbsp;2);</span></div></li>
<li><div class="src-line"><a name="a140"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(&quot;d&nbsp;=&nbsp;&quot;);</span></div></li>
<li><div class="src-line"><a name="a141"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(new&nbsp;Matrix(d,&nbsp;nparm)).print(10,&nbsp;2);</span></div></li>
<li><div class="src-line"><a name="a142"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a143"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(&quot;e0&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;e0&nbsp;+&nbsp;&quot;:&nbsp;&quot;);</span></div></li>
<li><div class="src-line"><a name="a144"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(&quot;moved&nbsp;from&nbsp;&quot;);</span></div></li>
<li><div class="src-line"><a name="a145"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(new&nbsp;Matrix(a,&nbsp;nparm)).print(10,&nbsp;2);</span></div></li>
<li><div class="src-line"><a name="a146"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(&quot;e1&nbsp;=&nbsp;&quot;&nbsp;+&nbsp;e1&nbsp;+&nbsp;&quot;:&nbsp;&quot;);</span></div></li>
<li><div class="src-line"><a name="a147"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(e1&nbsp;&lt;&nbsp;e0)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a148"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.print(&quot;to&nbsp;&quot;);</span></div></li>
<li><div class="src-line"><a name="a149"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(new&nbsp;Matrix(na,&nbsp;nparm)).print(10,&nbsp;2);</span></div></li>
<li><div class="src-line"><a name="a150"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a151"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&quot;move&nbsp;rejected&quot;);</span></div></li>
<li><div class="src-line"><a name="a152"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a153"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a154"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a155"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;termination&nbsp;test&nbsp;(slightly&nbsp;different&nbsp;than&nbsp;NR)</span></div></li>
<li><div class="src-line"><a name="a156"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(Math.abs(e1-e0)&nbsp;&gt;&nbsp;termepsilon)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a157"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;term&nbsp;=&nbsp;0;</span></div></li>
<li><div class="src-line"><a name="a158"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a159"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;term++;</span></div></li>
<li><div class="src-line"><a name="a160"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(term&nbsp;==&nbsp;4)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a161"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(&quot;terminating&nbsp;after&nbsp;&quot;&nbsp;+&nbsp;iter&nbsp;+&nbsp;&quot;&nbsp;iterations&quot;);</span></div></li>
<li><div class="src-line"><a name="a162"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;done&nbsp;=&nbsp;true;</span></div></li>
<li><div class="src-line"><a name="a163"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a164"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a165"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(iter&nbsp;&gt;=&nbsp;maxiter)&nbsp;done&nbsp;=&nbsp;true;</span></div></li>
<li><div class="src-line"><a name="a166"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a167"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;in&nbsp;the&nbsp;C++&nbsp;version,&nbsp;found&nbsp;that&nbsp;changing&nbsp;this&nbsp;to&nbsp;e1&nbsp;&gt;=&nbsp;e0</span></div></li>
<li><div class="src-line"><a name="a168"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;was&nbsp;not&nbsp;a&nbsp;good&nbsp;idea.&nbsp;&nbsp;See&nbsp;comment&nbsp;there.</span></div></li>
<li><div class="src-line"><a name="a169"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//</span></div></li>
<li><div class="src-line"><a name="a170"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(e1&nbsp;&gt;&nbsp;e0&nbsp;||&nbsp;Double.isNaN(e1))&nbsp;{&nbsp;//&nbsp;new&nbsp;location&nbsp;worse&nbsp;than&nbsp;before</span></div></li>
<li><div class="src-line"><a name="a171"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lambda&nbsp;*=&nbsp;10.;</span></div></li>
<li><div class="src-line"><a name="a172"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;new&nbsp;location&nbsp;better,&nbsp;accept&nbsp;new&nbsp;parameters</span></div></li>
<li><div class="src-line"><a name="a173"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lambda&nbsp;*=&nbsp;0.1;</span></div></li>
<li><div class="src-line"><a name="a174"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e0&nbsp;=&nbsp;e1;</span></div></li>
<li><div class="src-line"><a name="a175"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;simply&nbsp;assigning&nbsp;a&nbsp;=&nbsp;na&nbsp;will&nbsp;not&nbsp;get&nbsp;results&nbsp;copied&nbsp;back&nbsp;to&nbsp;caller</span></div></li>
<li><div class="src-line"><a name="a176"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(&nbsp;int&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;nparm;&nbsp;i++&nbsp;)&nbsp;{</span></div></li>
<li><div class="src-line"><a name="a177"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(vary[i])&nbsp;a[i]&nbsp;=&nbsp;na[i];</span></div></li>
<li><div class="src-line"><a name="a178"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a179"></a><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></div></li>
<li><div class="src-line"><a name="a180"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">while</span><span class="src-sym">(</span><span class="src-sym">!</span><span class="src-var">$done</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a181"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a182"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$lambda</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a183"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;solve()</span></div></li>
<li><div class="src-line"><a name="a184"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a185"></a><span class="src-sym">}&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;class&nbsp;LevenbergMarquardt</span></div></li>
</ol>
</div>
        <div class="credit">
		    <hr />
		    Documentation generated on Fri, 12 Oct 2012 00:16:34 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.4</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>